﻿@using StackExchange.Profiling;
@{
    Layout = null;
    
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>操作日志</title>
    <link rel="stylesheet" type="text/css" href="~/Content/jquery-easyui-1.4.1/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="~/Content/jquery-easyui-1.4.1/themes/icon.css">
    <script type="text/javascript" src="~/Content/jquery-easyui-1.4.1/jquery.min.js"></script>
    <script type="text/javascript" src="~/Content/jquery-easyui-1.4.1/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="~/Scripts/json2.js"></script>
    <script type="text/javascript" src="~/Scripts/app/app.core.js"></script>
    <script type="text/javascript" src="~/Scripts/app/app.ui.js"></script>
</head>
<body class="easyui-layout">
    <!--顶部-->
    <div data-options="region:'north'" style="height: 50px; background-color: gray;"></div>
    <!--底部-->
    <div data-options="region:'south',split:true" style="height:50px;">
        &copy; @DateTime.Now.Year - 版权声明
        @MiniProfiler.RenderIncludes()
    </div>
    <!--左边导航菜单-->
    <div data-options="region:'west',split:true" title="West" style="width:300px;">
        <div class="easyui-accordion" data-options="fit:true,border:false">
            <div title="组织架构" data-options="iconCls:'icon-ok'" style="overflow:auto;padding:10px;">
                <ul>
                    <li><a href="@Url.Action("RoleList", "Organization")" data-target="navTab" data-title="rolelist">角色列表</a></li>
                    <li><a href="~/Organization/UserList" data-target="navTab" data-title="userlist">系统用户</a></li>
                </ul>
            </div>
            <div title="系统管理" data-options="iconCls:'icon-help'" style="padding:10px;">
                <ul>
                    <li>菜单列表</li>
                    <li>权限中心</li>
                    <li>数据权限</li>
                </ul>
            </div>
        </div>

    </div>
    <!--主体-->
    <div data-options="region:'center',title:'Main Title',iconCls:'icon-ok'">
        <div class="easyui-tabs" data-options="fit:true,border:false,plain:true" id="tabContainer">
            <div title="DataGrid" style="padding:5px">

                <div class="easyui-layout" data-options="fit:true">
                    <div data-options="region:'north',title:'查询用户',split:true" style="height:150px;">
                        <table>
                            <tr>
                                <td>商品名称：</td>
                                <td>
                                    <input class="easyui-textbox" type="text" id="lk_s_Name"
                                           data-options="prompt:'输入商品名称...'" style="width:200px;height:32px" />
                                </td>
                                <td>售价：</td>
                                <td>
                                    <input class="easyui-textbox" type="text" id="ge_d_Price"
                                           style="width:100px;height:32px" />
                                    &nbsp;~&nbsp;
                                    <input class="easyui-textbox" type="text" id="le_d_Price"
                                           style="width:100px;height:32px" />
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <a id="btnSearch" href="#none" class="easyui-linkbutton" data-options="iconCls:'icon-search'">查詢</a>
                                </td>
                                <td>&nbsp;</td>
                                <td>&nbsp;</td>
                                <td>&nbsp;</td>
                            </tr>
                        </table>

                    </div>
                    <div data-options="region:'center',title:'用户列表'" style="padding:5px;background:#eee;">
                        <!--这里不要写class="easyui-datagrid",$.ready里会做初始化-->
                        <table id="list_data"
                               data-options="url:'@Url.Action("VegList", "Home")',method:'post',rownumbers:true,singleSelect:true,pagination:true,sortName:'Id',sortOrder:'asc',fit:true,fitColumns:true,queryParams:getQueryParams()">
                            <thead>
                                <tr>
                                    <th data-options="field:'Name'" width="150">名称</th>
                                    <th data-options="field:'MainVeg'" width="200">备注</th>
                                    <th data-options="field:'Price',align:'right'" width="100">售价</th>
                                    <th data-options="field:'Integral',align:'right'" width="100">积分</th>
                                    <th data-options="field:'Weight'" width="150">规格</th>
                                    <th data-options="field:'Edible'" width="150">食用方式</th>
                                </tr>
                            </thead>
                        </table>

                    </div>
                </div>
                </div>
        </div>
    </div>
    <script type="text/javascript">
        $().ready(function () {
            var $this = $(this);
            initUI($this);

            var $datagrid = $('#list_data');
            $datagrid.datagrid();//初始化EasyUI Grid控件
            
            $("#btnSearch").on("click", function () {
            
                $datagrid.datagrid('options').queryParams = getQueryParams();
                $datagrid.datagrid('load');
            });
        });

        function getQueryParams() {
            var inputs = ["lk_s_Name", "ge_d_Price", "le_d_Price"];
            var query = {};

            for (var i = 0; i < inputs.length; i++) {
                var inputname = inputs[i];
                var $input = $("#" + inputname);
                //控件没找到，忽略
                if($input.length==0) continue;

                var inputVal = $input.val();
                //未输入值，忽略
                if (inputVal.length == 0) continue;

                query[inputname] = inputVal;
            }
            return query;
        }
    </script>
    
</body>
</html>
